<?php
include("../util/session.php");
	require_once ("../config.inc.php");
	require_once ("../include/mysql.inc.php");
	require_once ("../include/article.inc.php");
	require_once ("../include/articleType.inc.php");
	$id = mysql_escape_string($_GET["id"]);
	$articleDao = new Article();
	$articleRow = $articleDao->queryById($id);//文章详情
	$articleTypeDao = new ArticleType();
	$typeRows = $articleTypeDao->query();
?>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title></title>
		<link rel="stylesheet" href="../lib/kindeditor-4.0.6/themes/default/default.css" />
		
		<script charset="utf-8" src="../lib/kindeditor-4.0.6/kindeditor.js"></script>
		<script charset="utf-8" src="../lib/kindeditor-4.0.6/lang/zh_CN.js"></script>
		<script charset="utf-8" src="../lib/kindeditor-4.0.6/plugins/code/prettify.js"></script>
		<link rel="stylesheet" href="../lib/kindeditor-4.0.6/plugins/code/prettify.css" />
	
		<script type="text/javascript" src="../lib/jquery/jquery-1.6.js"></script>
	
		<link type="text/css" rel="stylesheet" href="../lib/syntaxhighlighter_3.0.83/styles/shCoreDefault.css">
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shCore.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushJScript.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushAppleScript.js"></script>
		<script type="text/javascript" src=".../lib/syntaxhighlighter_3.0.83/scripts/shBrushAS3.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushBash.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushCpp.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushCSharp.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushCss.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushJava.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushJavaFX.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushPerl.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushPhp.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushXml.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushSql.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushPowerShell.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushPython.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushVb.js"></script>
		<script type="text/javascript" src="../lib/syntaxhighlighter_3.0.83/scripts/shBrushJScript.js"></script>
			<script type="text/javascript">SyntaxHighlighter.all();</script>
		
		<script type="text/javascript">
			KindEditor.ready(function(K) {
				var editor1 = K.create('textarea[name="content"]', {
					cssPath : '../lib/kindeditor-4.0.6/plugins/code/prettify.css',
					uploadJson : '../action/ke/upload_json.php',
					fileManagerJson : '../action/ke/file_manager_json.php',
					allowFileManager : true,
					allowFileManager : true,
					afterCreate : function() {
						var self = this;
						K.ctrl(document, 13, function() {
							self.sync();
							K('form[name=example]')[0].submit();
						});
						K.ctrl(self.edit.doc, 13, function() {
							self.sync();
							K('form[name=example]')[0].submit();
						});
					}
				});
				prettyPrint();
			});
		</script>
	</head>
	<body>
			<?php
				require './inc_header.php';
			?>
			<form action="../action/article/updateActicle.php" method="post" >
				<input type="submit" value="发表文章"></input><br />
				<input type="hidden" name="id" value="<?php echo $id; ?>">
				标题：
				<input type="text" name="title" size="100" value="<?php echo $articleRow[title];?>"></input><br />
				类型：
				<select name="typeId">
					<?php
						foreach ($typeRows as $value) { 
					?>
							<option <?php echo $articleRow[typeId] == $value[id] ? 'selected="selected"' : '';?> value="<?php echo $value[id] ?>"><?php echo $value[name] ?></option>
					<?php 
						}
					?>
				</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				置顶：
				<input type="checkbox" name="top" <?php echo $articleRow[top] == '1' ? 'checked="checked"' : '';?>  value="1"></input>
				<br />
				<br />
				<textarea name="content" cols="100" rows="20" wrap="VIRTUAL" value="<?php echo $articleRow[content];?>">
					<?php echo $articleRow[content];?>
				</textarea>
				
			</form>
	</body>
</html>